package com.front.teacher.teacherapp.view.fragment;


import android.content.Intent;
import android.view.View;
import android.widget.Button;

import com.front.teacher.teacherapp.R;
import com.front.teacher.teacherapp.base.BaseFragment;
import com.front.teacher.teacherapp.presenter.DynamicPresenter;
import com.front.teacher.teacherapp.view.activity.CameraActivity;
import com.front.teacher.teacherapp.view.activity.evaluate.TeacherEvaluateActivity;
import com.front.teacher.teacherapp.view.impl.IDynamicView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * 动态碎片
 */
public class DynamicFragment extends BaseFragment<IDynamicView, DynamicPresenter> implements IDynamicView {

    public static DynamicFragment dynamicFragment;
    @InjectView(R.id.button_teacher_dynamic)
    Button buttonTeacherDynamic;
    @InjectView(R.id.button_medal_dynamic)
    Button buttonMedalDynamic;

    public static DynamicFragment newInstance() {
        if (dynamicFragment == null) {
            dynamicFragment = new DynamicFragment();
        }
        return dynamicFragment;
    }


    @Override
    public DynamicPresenter initPresenter() {
        return new DynamicPresenter(this);
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_dynamic;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }

    @OnClick({R.id.button_teacher_dynamic, R.id.button_medal_dynamic})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.button_teacher_dynamic:
                Intent intent = new Intent(getContext(), TeacherEvaluateActivity.class);
                startActivity(intent);
                break;
            case R.id.button_medal_dynamic:
                Intent intent1 = new Intent(getContext(), CameraActivity.class);
                startActivity(intent1);
                break;
        }
    }
}
